View Javadoc

1   /*
2   jMimeMagic(TM) is a Java library for determining the content type of files or
3   streams.
4   
5   Copyright (C) 2004 David Castro
6   
7   This library is free software; you can redistribute it and/or
8   modify it under the terms of the GNU Lesser General Public
9   License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11  
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  Lesser General Public License for more details.
16  
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library; if not, write to the Free Software
19  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  
21  For more information, please email arimus@users.sourceforge.net
22  */
23  package net.sf.jmimemagic;
24  
25  import java.io.File;
26  
27  import java.util.Map;
28  
29  
30  /***
31   * DOCUMENT ME!
32   *
33   * @author $Author$
34   * @version $Revision$
35    */
36  public interface MagicDetector
37  {
38      // get the short name of this detector
39      /***
40       * DOCUMENT ME!
41       *
42       * @return DOCUMENT ME!
43       */
44      public String getName();
45  
46      // get the display name of this detector
47      /***
48       * DOCUMENT ME!
49       *
50       * @return DOCUMENT ME!
51       */
52      public String getDisplayName();
53  
54      // get the version of this plugin
55      /***
56       * DOCUMENT ME!
57       *
58       * @return DOCUMENT ME!
59       */
60      public String getVersion();
61  
62      // get a list of types this detector handles
63      /***
64       * DOCUMENT ME!
65       *
66       * @return DOCUMENT ME!
67       */
68      public String[] getHandledTypes();
69  
70      // get a list of file extensions this detector typically deals with
71      /***
72       * DOCUMENT ME!
73       *
74       * @return DOCUMENT ME!
75       */
76      public String[] getHandledExtensions();
77  
78      // process the stream and return all matching content types
79      /***
80       * DOCUMENT ME!
81       *
82       * @param data DOCUMENT ME!
83       * @param offset DOCUMENT ME!
84       * @param length DOCUMENT ME!
85       * @param bitmask DOCUMENT ME!
86       * @param comparator DOCUMENT ME!
87       * @param mimeType DOCUMENT ME!
88       * @param params DOCUMENT ME!
89       *
90       * @return DOCUMENT ME!
91       */
92      public String[] process(byte[] data, int offset, int length, long bitmask, char comparator,
93          String mimeType, Map params);
94  
95      // process the file and return all matching content types
96      /***
97       * DOCUMENT ME!
98       *
99       * @param file DOCUMENT ME!
100      * @param offset DOCUMENT ME!
101      * @param length DOCUMENT ME!
102      * @param bitmask DOCUMENT ME!
103      * @param comparator DOCUMENT ME!
104      * @param mimeType DOCUMENT ME!
105      * @param params DOCUMENT ME!
106      *
107      * @return DOCUMENT ME!
108      */
109     public String[] process(File file, int offset, int length, long bitmask, char comparator,
110         String mimeType, Map params);
111 }